@import './variables.scss';

@mixin table {
  width: 100%;
  border-spacing: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

$border-style: 1px solid $border-color-second;

.l-table {
  position: relative;
  font-size: 14px;
  box-sizing: border-box;
  overflow: hidden;
  .is-current {
    background-color: rgba($color: $color-main, $alpha: .15);
    transition: background-color .2s ease-in-out;
  }
}

.l-table::before {
  content: '';
  height: 1px;
  width: 100%;
  background-color: $border-color-second;
  position:absolute;
  bottom: 0px;
}

.l-table-body__wrapper {
  overflow: auto;
}

.l-table-fix-head .l-table-head__wrapper{
  position: sticky;
  top: 0;
  background-color: #ffffff;
}

.l-table-body-tr, .l-table-head-tr {
  height: 40px;
}

.l-table-head__table, .l-table-body__table {
  @include table
}

.l-table-head, .l-table-body {
  width: 100%;
  th, td {
    text-align: left;
    padding: 0 10px;
  }
  th.is-center, td.is-center {
    text-align: center;
  }
  th.is-right, td.is-right {
    text-align: right;
  }
}

// 表头样式
.l-table-head {
  color: $table-head-color;
  font-weight: bold;
}

// 无 border 时，边框样式
.l-table-body-tr, .l-table-head-tr {
  border-bottom: $border-style;
}

// body 行样式
.l-table-body-tr {
  color: $text-normal;
  transition: background-color .2s ease-in-out;
  &:hover {
    background-color: #f5f7fa;
    transition: background-color .1s;
  }
}

// border
.l-table-border{
  border: $border-style;
  border-bottom: 0;
  .l-table-body-tr {
    // border-left: $border-style;
    // border-right: $border-style;
  }
  .l-table-head-tr {
    // border: $border-style;
  }
  .l-table-head-tr th:not(:last-child), .l-table-body-tr td:not(:last-child) {
    border-right: $border-style;
  }
}
